package ${setServicePackageName};

import java.util.Arrays;
import ${setDomainPackageName}.${DOMAIN_CLASSNAME};
import ${setMapperPackageName}.${MAPPER_CLASSNAME};
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.AllArgsConstructor;


/**
 * Description:${tableAnnotation}服务类
 * @author ${author}
 * @date ${date}
 */
@Service
@AllArgsConstructor
public class ${SERVICE_CLASSNAME} {

    private final ${MAPPER_CLASSNAME} ${mapper_classname};
<#--    @Autowired-->
<#--    public ${SERVICE_CLASSNAME}(${MAPPER_CLASSNAME} ${mapper_classname}) {-->
<#--        this.${mapper_classname} = ${mapper_classname};-->
<#--    }-->

    /** 
     * Description:新增${tableAnnotation}
     *
     * @param ${domain_classname} ${tableAnnotation}
     * @return int
     * @author ${author}
     * @date ${dateTime}
     */
    @Transactional
    public int create${DOMAIN_CLASSNAME}(${DOMAIN_CLASSNAME} ${domain_classname}){
        return this.${mapper_classname}.create${DOMAIN_CLASSNAME}(${domain_classname});
    }

    /** 
     * Description:根据id修改${tableAnnotation}
     *
     * @param ${domain_classname} ${tableAnnotation}
     * @return int
     * @author ${author}
     * @date ${dateTime}
     */
    @Transactional
    public int update${DOMAIN_CLASSNAME}ById(${DOMAIN_CLASSNAME} ${domain_classname}){
        return this.${mapper_classname}.update${DOMAIN_CLASSNAME}ById(${domain_classname});
    }

    /**
    * Description:根据id删除${tableAnnotation}
    *
    * @param id id
    * @return int
    * @author ${author}
    * @date ${dateTime}
    */
    @Transactional
    public int delete${DOMAIN_CLASSNAME}ById(${primaryKeyModtype} id){
        return this.${mapper_classname}.delete${DOMAIN_CLASSNAME}ById(id);
    }

    /** 
     * Description:根据ids删除${tableAnnotation}
     *
     * @param ids id字符串数组
     * @return int
     * @author ${author}
     * @date ${dateTime}
     */
    @Transactional
    public int delete${DOMAIN_CLASSNAME}ByIds(String ids){
        return this.${mapper_classname}.delete${DOMAIN_CLASSNAME}ByIds(Arrays.asList(ids.split(",")));
    }
    
    /** 
     * Description:根据id查找${tableAnnotation}
     *
     * @param id id
     * @return ${setDomainPackageName}.${DOMAIN_CLASSNAME}
     * @author ${author}
     * @date ${dateTime}
     */
    public ${DOMAIN_CLASSNAME} select${DOMAIN_CLASSNAME}ById(${primaryKeyModtype} id){
        return this.${mapper_classname}.select${DOMAIN_CLASSNAME}ById(id);
    }

    /**
    * Description:查询${tableAnnotation}列表
    *
    * @param ${domain_classname} ${tableAnnotation}
    * @return java.util.List<${setDomainPackageName}.${DOMAIN_CLASSNAME}>
    * @author ${author}
    * @date ${dateTime}
    */
    public List<${DOMAIN_CLASSNAME}> select${DOMAIN_CLASSNAME}List(${DOMAIN_CLASSNAME} ${domain_classname}){
        return this.${mapper_classname}.select${DOMAIN_CLASSNAME}List(${domain_classname});
    }
}

